home *** CD-ROM | disk | FTP | other *** search
- // This is a part of the Microsoft Foundation Classes C++ library.
- // Copyright (C) 1992-1998 Microsoft Corporation
- // All rights reserved.
- //
- // This source code is only intended as a supplement to the
- // Microsoft Foundation Classes Reference and related
- // electronic documentation provided with the library.
- // See these sources for detailed information regarding the
- // Microsoft Foundation Classes product.
-
- /////////////////////////////////////////////////////////////////////////////
- // WCEIMPL.H
- //
- // THIS FILE IS FOR MFCCE IMPLEMENTATION ONLY.
-
- #ifndef __WCEIMPL_H__
- #define __WCEIMPL_H__
-
- // Define libraries to be used in MFC and OLE DLLs.
- #if (_WIN32_WCE >= 201)
- #pragma comment(lib, "corelibc.lib")
- #pragma comment(linker, "/nodefaultlib:libc.lib")
- #pragma comment(linker, "/nodefaultlib:libcd.lib")
- #pragma comment(linker, "/nodefaultlib:libcmt.lib")
- #pragma comment(linker, "/nodefaultlib:libcmtd.lib")
- #pragma comment(linker, "/nodefaultlib:oldnames.lib")
- #else
- #ifdef _MT
- #if defined(_DEBUG)
- #pragma comment(lib, "libcmtd.lib")
- #else
- #pragma comment(lib, "libcmt.lib")
- #endif
- #else
- #error Please use the /MT switch (multithreaded C-runtime)
- #endif
- #endif
-
-
- #if defined(_AFX_OLE_IMPL)
- #if defined(_DEBUG)
- #pragma comment(lib, WCE_MFC_FILENAME(d.lib))
- #else
- #pragma comment(lib, WCE_MFC_FILENAME(.lib))
- #endif
- #pragma comment(lib, "uuid.lib")
- #endif
-
- // New front-end compiler complains of empty statements (solitary ;'s)
- #pragma warning(disable: 4390) // empty statements are okay
-
- // ctlcore.cpp might contain an empty switch statement depending on pruning macros
- #pragma warning(disable: 4060) // empty statements are okay
-
- #pragma comment(lib, "coredll.lib")
- #pragma comment(lib, "commctrl.lib")
-
- typedef struct tagNCCALCSIZE_PARAMS {
- RECT rgrc[3];
- PWINDOWPOS lppos;
- } NCCALCSIZE_PARAMS, *LPNCCALCSIZE_PARAMS;
-
- // Missing typedefs
- #ifndef _TIME_T_DEFINED
- typedef unsigned long time_t;
- #define _TIME_T_DEFINED
- #endif
- typedef HANDLE HDWP;
- typedef HANDLE HDROP;
- typedef wchar_t _TUCHAR;
- typedef LPVOID LPPRINTER_DEFAULTS;
- typedef LPVOID LPCHOOSEFONT;
- #if (_WIN32_WCE < 210)
- typedef LPVOID LPPAGESETUPDLG;
- #endif // _WIN32_WCE < 210
- typedef UINT UWORD;
-
- // Missing headers
- #include "prsht.h"
-
- // Missing string functions aliases
- #ifndef _istlead
- #define _istlead(ch) (FALSE)
- #endif
- #ifndef _vsnwprintf
- #define _vsnwprintf(a,b,c,d) vswprintf(a,c,d)
- #endif
- #define lstrcmpA strcmp
- #define lstrcatA strcat
- #define _ttoi _wtoi
- #define _itot _itow
- #define _ltot _ltow
- #define _ultot _ultow
- #define lstrlenA strlen
- #define lstrcpyA strcpy
- #define lstrcpyn _tcsncpy
- #define _tcstol wcstol
- #define _tcstoul wcstoul
- #define _tcstod wcstod
- #define strtod wcstod
- #define _tcsdec _wcsdec
- #define _tcsinc _wcsinc
- __inline wchar_t * __cdecl _wcsdec(const wchar_t * start, const wchar_t * current)
- { return (wchar_t *) ( (start>=current) ? NULL : (current-1) ); }
- __inline wchar_t * __cdecl _wcsinc(const wchar_t * _pc) { return (wchar_t *)(_pc+1); }
- __inline size_t __cdecl _tclen( const wchar_t *_cpc) { return 2; } // for UNICODE
-
- // Missing definitions: not necessary equal to their Win32 values
- // (the goal is to just have a clean compilation of MFC)
- #define BS_USERBUTTON BS_PUSHBUTTON
- #define WS_THICKFRAME WS_DLGFRAME
- #define WS_MAXIMIZE 0
- #define WS_MINIMIZE 0
- #define WS_EX_CONTROLPARENT 0x00010000L
- #define WS_EX_LEFTSCROLLBAR 0
- #ifndef WS_EX_TOOLWINDOW
- #define WS_EX_TOOLWINDOW 0
- #endif
- #define WS_EX_NOPARENTNOTIFY 0
- #define WM_ENTERIDLE 0x0121
- #define WM_PRINT WM_PAINT
- #define WM_NCCREATE (0x0081)
- #define WM_PARENTNOTIFY 0
- #define WM_NCDESTROY (WM_APP-1)
- #ifndef SW_RESTORE
- #define SW_RESTORE (SW_SHOWNORMAL)
- #endif
- #define SW_NORMAL (SW_SHOWNORMAL)
- #define SW_SHOWMINNOACTIVE (SW_HIDE)
- #define MB_TYPEMASK (0x0000000FL)
- #define MB_ICONMASK (0x000000F0L)
- #define CTLCOLOR_SCROLLBAR CTLCOLOR_EDIT
- #define PSM_CANCELTOCLOSE (WM_USER + 107)
- #define ESB_ENABLE_BOTH (0x0000)
- #define RDW_INVALIDATE (0x0001)
- #define RDW_INTERNALPAINT (0x0002)
- #define RDW_ERASE (0x0004)
- #define RDW_VALIDATE (0x0008)
- #define RDW_NOINTERNALPAINT (0x0010)
- #define RDW_NOERASE (0x0020)
- #define RDW_NOCHILDREN (0x0040)
- #define RDW_ALLCHILDREN (0x0080)
- #define RDW_UPDATENOW (0x0100)
- #define RDW_ERASENOW (0x0200)
- #define RDW_FRAME (0x0400)
- #define RDW_NOFRAME (0x0800)
- #ifndef DCX_CACHE
- #define DCX_CACHE (0x00000002L)
- #endif
- #define INTERNET_HANDLE_TYPE_GOPHER_FILE -1
- #define INTERNET_SERVICE_GOPHER 0
- #define WAIT_OBJECT_0 0x00000000L
- #define PRF_CHILDREN 0x00000010L
- #define PRF_CLIENT 0x00000004L
- #define HELP_HELPFILE (0x0000L)
- #define MSGF_MENU 2
- #define pshHelp 0x040E
- #define SM_DBCSENABLED 42
- #define MF_BITMAP 0x00000004L
- #define MF_DISABLED 0
- #define FW_REGULAR FW_NORMAL
- #define MB_TASKMODAL 0
- #define MB_SYSTEMMODAL MB_APPLMODAL
- #define PDERR_DNDMMISMATCH 0x1009
- #define PDERR_DEFAULTDIFFERENT 0x100C
- #define IDB_HIST_SMALL_COLOR 8
- #define IDB_HIST_LARGE_COLOR 9
- #define DEFAULT_GUI_FONT SYSTEM_FONT
- #define SFGAO_LINK 0x00010000L
- #ifndef _MAX_FNAME
- #define _MAX_FNAME 64
- #endif
- #ifndef SWP_NOREDRAW
- #define SWP_NOREDRAW 0
- #endif
- #ifndef SBS_SIZEBOX
- #define SBS_SIZEBOX 0
- #endif
- #ifndef SBS_SIZEGRIP
- #define SBS_SIZEGRIP 0
- #endif
- #define SC_SIZE (0xF000)
- #define WSAGETSELECTEVENT(lParam) LOWORD(lParam)
- #define WSAGETSELECTERROR(lParam) HIWORD(lParam)
- #define HWND_TOPMOST ((HWND)-1)
- #define HWND_NOTOPMOST ((HWND)-2)
- #define HCBT_CREATEWND (3)
- #define CC_SHOWHELP 0
- #define PS_DOT 2
- #define PD_ALLPAGES 0
- #define PD_USEDEVMODECOPIES 0
- #define PD_NOSELECTION 0
- #define PD_HIDEPRINTTOFILE 0
- #define PD_NOPAGENUMS 0
- #define CF_METAFILEPICT 3
- #define CWP_ALL 0x0000
- #define CWP_SKIPINVISIBLE 0x0001
- #define CWP_SKIPDISABLED 0x0002
- #define CWP_SKIPTRANSPARENT 0x0004
- #define MM_LOMETRIC 2
- #define MM_HIMETRIC 3
- #define MM_LOENGLISH 4
- #define MM_HIENGLISH 5
- #define MM_TWIPS 6
- #define MM_ISOTROPIC 7
- #define MM_ANISOTROPIC 8
- #define OLEUI_FALSE 0
- #define OLEUI_SUCCESS 1
- #define OLEUI_OK 1
- #define OLEUI_CANCEL 2
- #define KF_EXTENDED 0x0100
- #define KF_DLGMODE 0x0800
- #define KF_MENUMODE 0x1000
- #define KF_ALTDOWN 0x2000
- #define KF_REPEAT 0x4000
- #define KF_UP 0x8000
- #define IDB_STD_SMALL_MONO 2
- #define IDB_STD_LARGE_MONO 3
- #define IDB_VIEW_SMALL_MONO 6
- #define IDB_VIEW_LARGE_MONO 7
- #define SPI_GETWORKAREA 48
- #define LBSELCHSTRING TEXT("commdlg_LBSelChangedNotify")
- #define SHAREVISTRING TEXT("commdlg_ShareViolation")
- #define FILEOKSTRING TEXT("commdlg_FileNameOK")
- #define COLOROKSTRING TEXT("commdlg_ColorOK")
- #define SETRGBSTRING TEXT("commdlg_SetRGBColor")
- #define HELPMSGSTRING TEXT("commdlg_help")
- #define FINDMSGSTRING TEXT("commdlg_FindReplace")
- #define DRAGLISTMSGSTRING TEXT("commctrl_DragListMsg")
-
- // Provide zero values for unsupported GetOpenFileName flags
- #define OFN_ENABLESIZING 0
- #if defined(_WIN32_WCE_PSPC)
- #define OFN_READONLY 0
- #define OFN_ENABLEHOOK 0
- #define OFN_ENABLETEMPLATE 0
- #define OFN_ALLOWMULTISELECT 0
- #endif // _WIN32_WCE_PSPC
-
- #if defined(_WIN32_WCE_PSPC)
- #define BM_GETIMAGE 0x00F6
- #define BM_SETIMAGE 0x00F7
- #endif // _WIN32_WCE_PSPC
-
-
- #ifndef WM_SETCURSOR
- #define WM_SETCURSOR 0x0020
- #define IDC_ARROW MAKEINTRESOURCE(32512)
- #define IDC_IBEAM MAKEINTRESOURCE(32513)
- #define IDC_WAIT MAKEINTRESOURCE(32514)
- #define IDC_CROSS MAKEINTRESOURCE(32515)
- #define IDC_UPARROW MAKEINTRESOURCE(32516)
- #define IDC_SIZE MAKEINTRESOURCE(32646)
- #define IDC_ICON MAKEINTRESOURCE(32512)
- #define IDC_SIZENWSE MAKEINTRESOURCE(32642)
- #define IDC_SIZENESW MAKEINTRESOURCE(32643)
- #define IDC_SIZEWE MAKEINTRESOURCE(32644)
- #define IDC_SIZENS MAKEINTRESOURCE(32645)
- #define IDC_SIZEALL MAKEINTRESOURCE(32646)
- #define IDC_NO MAKEINTRESOURCE(32648)
- #define IDC_APPSTARTING MAKEINTRESOURCE(32650)
- #define IDC_HELP MAKEINTRESOURCE(32651)
- #define IDC_HAND MAKEINTRESOURCE(32649)
- #endif
-
-
-
- inline HINSTANCE wce_GetModuleHandleW(LPCWSTR lpModuleName)
- {
- #if (_WIN32_WCE >= 210)
- return GetModuleHandleW(lpModuleName);
- #else // _WIN32_WCE
- HINSTANCE hInst = LoadLibraryW(lpModuleName);
- if(hInst)
- FreeLibrary(hInst);
- return hInst;
- #endif // _WIN32_WCE
- }
-
- inline HICON wce_ExtractIcon(HINSTANCE hInst, LPCWSTR lpszExeFileName, UINT nIconIndex)
- {
- return (HICON)::ExtractIconEx(lpszExeFileName, nIconIndex, NULL, NULL, 1);
- }
-
- inline int wce_MulDiv(int nNumber, int nNumerator, int nDenominator)
- {
- __int64 x;
-
- x = (__int64)nNumber * (__int64)nNumerator;
- x /= (__int64)nDenominator;
-
- return (int)x;
- }
-
- inline HINSTANCE wce_GetModuleHandleA(LPCSTR lpModuleName)
- {
- HINSTANCE hInst;
-
- TCHAR *szwBuf = wce_AsciiToWide(lpModuleName);
- hInst = wce_GetModuleHandleW(szwBuf);
- delete[] szwBuf;
-
- return hInst;
- }
-
- inline short wce_GetFileTitle(LPCTSTR lpszFile, LPTSTR lpszTitle, WORD cbBuf)
- {
- return wce_GetFileTitleW(lpszFile, lpszTitle, cbBuf);
- }
-
- #define GMEM_MOVEABLE 0
- #define GMEM_SHARE 0
- #define GMEM_FIXED LMEM_FIXED
- #define GMEM_ZEROINIT LMEM_ZEROINIT
- #define GMEM_INVALID_HANDLE LMEM_INVALID_HANDLE
- #define GMEM_LOCKCOUNT LMEM_LOCKCOUNT
- #define GPTR LPTR
-
- inline HGLOBAL wce_GlobalAlloc(UINT uFlags, DWORD dwBytes)
- {
- UINT uLocalFlags = (uFlags & GMEM_ZEROINIT)? 0 : LMEM_ZEROINIT;
- return (HGLOBAL)::LocalAlloc(uLocalFlags, (UINT)dwBytes);
- }
-
- inline HGLOBAL wce_GlobalFree(HGLOBAL hMem)
- {
- return ::LocalFree((HLOCAL)hMem);
- }
-
- inline HGLOBAL wce_GlobalReAlloc(HGLOBAL hMem, DWORD dwBytes, UINT uFlags)
- {
- UINT uLocalFlags = (uFlags & GMEM_ZEROINIT)? 0 : LMEM_ZEROINIT;
- return (HGLOBAL)::LocalReAlloc((HLOCAL)hMem, uLocalFlags, (UINT)dwBytes);
- }
-
- inline DWORD wce_GlobalSize(HGLOBAL hMem)
- {
- return (DWORD)::LocalSize((HLOCAL)hMem);
- }
-
- inline LPVOID wce_GlobalLock(HGLOBAL hMem)
- {
- return LocalLock((HLOCAL)hMem);
- }
-
- inline BOOL wce_GlobalUnlock(HGLOBAL hMem)
- {
- return LocalUnlock((HLOCAL)hMem);
- }
-
- inline HGLOBAL wce_GlobalHandle(LPCVOID pMem)
- {
- return (HGLOBAL)LocalHandle(pMem);
- }
-
- inline UINT wce_GlobalFlags(HGLOBAL hMem)
- {
- return LocalFlags((HLOCAL)hMem);
- }
-
- inline DWORD wce_GetVersion()
- {
- return 4;
- }
-
- inline void* wce_calloc(size_t num, size_t size)
- {
- void *ptr = malloc(num*size);
- if(ptr)
- memset(ptr, 0, num*size);
- return ptr;
- }
-
- inline void* wce__expand(void* pvMemBlock, size_t iSize)
- {
- return realloc(pvMemBlock, iSize);
- }
-
- extern "C" void __cdecl exit(int);
- inline void wce_abort()
- {
- exit(3);
- }
-
- inline unsigned long wce__beginthreadex(void *security, unsigned stack_size,
- unsigned (__stdcall *start_address)(void *),
- void *arglist, unsigned initflag,
- unsigned *thrdaddr)
- {
- return (unsigned long)CreateThread((LPSECURITY_ATTRIBUTES)security,
- (DWORD)stack_size,
- (LPTHREAD_START_ROUTINE)start_address,
- (LPVOID)arglist,
- (DWORD)initflag | CREATE_SUSPENDED,
- (LPDWORD)thrdaddr);
- }
-
- inline void wce__endthreadex(unsigned nExitCode)
- {
- ExitThread((DWORD)nExitCode);
- }
-
- inline BOOL wce_GetCursorPos(LPPOINT lpPoint)
- {
- #if (_WIN32_WCE >= 210)
- return ::GetCursorPos(lpPoint);
- #else // _WIN32_WCE
- return ::GetCaretPos(lpPoint);
- #endif // _WIN32_WCE
- }
-
- inline HDWP wce_BeginDeferWindowPos(int nNumWindows)
- {
- return (HDWP)1; // a fake handle
- }
-
- inline HDWP wce_DeferWindowPos(HDWP hWinPosInfo, HWND hWnd, HWND hWndInsertAfter,
- int x, int y, int cx, int cy, UINT uFlags)
- {
- ::SetWindowPos(hWnd, hWndInsertAfter, x, y, cx, cy, uFlags);
- return (HDWP)1; // a fake handle
- }
-
- inline BOOL wce_EndDeferWindowPos(HDWP hWinPosInfo)
- {
- return TRUE;
- }
-
- #endif // __WCEIMPL_H__
-